package com.genexususa.eo.connection.google.analytics;

import org.w3c.dom.Document;
import org.xml.sax.InputSource;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.StringReader;

/**
 * Created with IntelliJ IDEA.
 * User: Emiliano Martinez
 * Date: 11/6/12
 * Time: 2:16 PM
 * To change this template use File | Settings | File Templates.
 */
public class Util {


    public Document loadXMLFromString(String xml) throws Exception{
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        factory.setNamespaceAware(true); // never forget this!
        InputSource is = new InputSource(new StringReader(xml));
        return builder.parse(is);
    }

}
